# Maintainer: Ryuta Suzuki <oroppas@gmail.com>

_realname=networkx
pkgbase=mingw-w64-python2-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python2-${_realname}")
pkgver=2.2
pkgrel=2
pkgdesc="High-productivity software for complex networks (mingw-w64)"
arch=('any')
license=('BSD')
url="https://github.com/networkx/networkx"
depends=(
  "${MINGW_PACKAGE_PREFIX}-python2"
  "${MINGW_PACKAGE_PREFIX}-python2-decorator")
optdepends=(
  "${MINGW_PACKAGE_PREFIX}-python2-numpy"
  "${MINGW_PACKAGE_PREFIX}-python2-scipy"
  "${MINGW_PACKAGE_PREFIX}-python2-pyparsing"
  "${MINGW_PACKAGE_PREFIX}-python2-yaml")
makedepends=("${MINGW_PACKAGE_PREFIX}-python2-setuptools")
checkdepends=("${MINGW_PACKAGE_PREFIX}-python2-nose")
source=(${_realname}-${pkgver}.tar.gz::"https://github.com/networkx/networkx/archive/${_realname}-${pkgver}.tar.gz")
sha256sums=('74efce06507cdc2e506c6b7d485a18617adc3a7f355e2dc48ca71c83929bc679')

build() {
  cd ${srcdir}/${_realname}-${_realname}-${pkgver}
  ${MINGW_PREFIX}/bin/python2 setup.py build
}

# Python 2.7x will be discontinued next year so it might be pointless.
#check() {
#  cd ${srcdir}/${_realname}-${_realname}-${pkgver}
#  ${MINGW_PREFIX}/bin/nosetests2
#}

package() {
  cd ${srcdir}/${_realname}-${_realname}-${pkgver}
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python2 setup.py install --root=${pkgdir} --prefix=${MINGW_PREFIX} --optimize=1 --skip-build
  install -D -m644 LICENSE.txt ${pkgdir}${MINGW_PREFIX}/share/licenses/python2-${_realname}/LICENSE

  # Conflict files for both packages.
  rm -rf ${pkgdir}${MINGW_PREFIX}/share/doc
}
